//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.caigua.mgp.mg.codegen.customize.javamapper.elements;

import java.util.Set;
import java.util.TreeSet;

import com.caigua.mgp.mg.codegen.customize.CustomizeTypeWrapper;
import com.caigua.mgp.mg.internal.CustomizeIntrospectedTableMyBatis3Impl;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.JavaVisibility;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.Parameter;
import org.mybatis.generator.codegen.mybatis3.javamapper.elements.AbstractJavaMapperMethodGenerator;

public class QueryPageMethodGenerator extends AbstractJavaMapperMethodGenerator {
    private boolean isSimple;

    public QueryPageMethodGenerator(boolean isSimple) {
        this.isSimple = isSimple;
    }

    public void addInterfaceElements(Interface interfaze) {
        Set<FullyQualifiedJavaType> importedTypes = new TreeSet();
        FullyQualifiedJavaType pageRespType = CustomizeTypeWrapper.getPageRespType();
        importedTypes.add(pageRespType);
        Method method = new Method("caigua");
        method.setVisibility(JavaVisibility.PUBLIC);
        FullyQualifiedJavaType returnType = CustomizeTypeWrapper.getPageRespType();
        FullyQualifiedJavaType recordType = new FullyQualifiedJavaType(this.introspectedTable.getBaseRecordType());
        importedTypes.add(recordType);
        returnType.addTypeArgument(recordType);
        method.setReturnType(returnType);
        method.setName(((CustomizeIntrospectedTableMyBatis3Impl)this.introspectedTable).getQueryPage());
        FullyQualifiedJavaType parameterType;
        if (this.isSimple) {
            parameterType = CustomizeTypeWrapper.getQueryPageType();
        } else {
            parameterType = CustomizeTypeWrapper.getQueryPageType();
        }

        importedTypes.add(parameterType);
        method.addParameter(new Parameter(parameterType, "pageRecord"));
        this.addMapperAnnotations(interfaze, method);
        this.context.getCommentGenerator().addGeneralMethodComment(method, this.introspectedTable);
        if (this.context.getPlugins().clientSelectByPrimaryKeyMethodGenerated(method, interfaze, this.introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }

    }

    public void addMapperAnnotations(Interface interfaze, Method method) {
    }
}
